<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>每日还款 管理</title>
    <style type="text/css">
        .searchArea .fieldBox .label{width: 70px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">事业部</div>
                    <div class="field">
                        <input name="buOrgCd" id="buOrgCd" data-value="" placeholder="请选择" ltype="combobox">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">客户经理</div>
                    <div class="field">
                        <input name="cstMgrNm" id="cstMgrNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">客户名称</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">合同号</div>
                    <div class="field">
                        <input name="lsCntNo" id="lsCntNo" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">应付日期</div>
                    <div class="field">
                        <input ligerui="width: 82" name="payDtMin" id="payDtMin" type="text" class="ui-datepicker" value="">
                        -
                        <input ligerui="width: 82" name="payDtMax" id="payDtMax" type="text" class="ui-datepicker" value="">
                    </div>
                </div>

                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-round"></i>查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round"></i>清空</span>
                    <sys:funcAuth resCd="exportDecomList">
                        <span id="exportXlsBtn" class="sq-button sq-button-round">导出</span>
                    </sys:funcAuth>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>

    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null, callback=null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/capital/capDailyRepayment/initList.do',
            parms:{type:'${type}'},
            method: 'get',
            columns: [
                {display: '支付表号', name: 'paySchNo', minWidth: 130, align: 'center', enabledSort: false},
                {display: '事业部', name: 'buOrgCdNm', minWidth: 100, align: 'center', enabledSort: false},
                /* {display: '地区', name: 'orgShtNm', minWidth: 100, align: 'center', enabledSort: false}, */
                {display: '责任客户经理', name: 'cstMgrNm', minWidth: 100, align: 'center', enabledSort: false},
                {display: '客户名称', name: 'cstNm', minWidth: 100, align: 'center', enabledSort: false},
                {display: '融资租赁合同号', name: 'lsCntNo', minWidth: 130, align: 'center', enabledSort: false},
                {display: '起租日', name: 'lsDt', width: 110, align: 'center', enabledSort: false,render:renderDate},
                {display: '还款日', name: 'payDt', width: 110, align: 'center', enabledSort: false,render:renderDate},
                {display: '期次', name: 'payPd', minWidth: 100, align: 'center', enabledSort: false},
                {display: '业务用途', name: 'feeTypCdNm', minWidth: 100, align: 'center', enabledSort: false},
                {display: '应还款金额', name: 'feeAmt', width: 90, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        return '&yen;'+FormatMoney(rowdata.feeAmt/100);
                    }
                },
                {display: '实收金额', name: 'paidUpAmt', width: 90, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        return '&yen;'+FormatMoney(rowdata.paidUpAmt/100);
                    }
                },
                {display: '差额', name: 'arAmt', width: 90, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        return '&yen;'+FormatMoney(rowdata.arAmt/100);
                    }
                },
                ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: true,
            isSingleCheck:true,
            rownumbers: true,
            allowUnSelectRow: true
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();
      //事业部
        $("#buOrgCd").ligerComboBox({
            valueField: 'key',
            textField: 'value'
        });
        liger.get("buOrgCd").setData(${buOrgCdList});
        
        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
        	 clearLigerForm("searchBar");
        });

        callback = function () {
            grid.reload();
        };
      //导出
        $("#exportXlsBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType:'json',
                url: '<%=path%>/capital/capDailyRepayment/exportDailyRepaymentList.do',
                data:data,
                beforeSend:function(){
                    wait_dialog=$.ligerDialog.SQalert({content: '正在导出...',SQ_type: "waitting"});
                },
                success:function(msg){
                    wait_dialog.close();
                    if(msg.success == 1){
                        window.open(msg.data);
                    }else{
                        $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                    }
                }
            });
        });
      
    });

    //格式化时间
    function renderDate(rowdata, rowindex, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }

</script>

</body>
</html>
